<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWxCardMemberGive extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //微信会员赠送纪录表
        Schema::create('wx_card_member_gives', function (Blueprint $table) {
            $table->increments('id')->comment('自增序号');
            $table->string('openid', 100)->default('')->comment('领券用户openid');
            $table->unsignedInteger('card_base_id')->default(0)->comment('卡券主键唯一ID');
            $table->string('level_key', 50)->default('')->comment('等级标识');
            $table->text('give_bonus')->nullable()->comment('团购券专用，团购详情');
            $table->text('give_coupon')->nullable()->comment('兑换券专用，填写兑换内容的名称');
            $table->softDeletes();
            $table->timestamps();
            $table->index(['openid','card_base_id','level_key','deleted_at'], 'index1');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_card_member_gives');
    }
}
